AI Behaviour Trees

date: 2023-01-31
author: Peterino

AI Behavior trees can be broken into multiple assets

here's an example

New Behavior tree runs NewBehaviourTree1. Statuses and events will propagate up from one to the other.

You can run state trees dynamically with Run Dynamic Behavior

This node for example will run a dynamic behavior tree.

From C++ there is a function called UBehaviorComponent::SetDynamicSubtree

This function takes in a gameplay tag and a reference to a UBehaviorTree asset.

Notice the

Injection tag parameter.

All nodes matching this tag, will have their behavior trees set by the SetDynamicSubtree call.

Putting it together we can basically author a bunch of attacks using dynamic subtrees. and run it all through two tasks.

The second task there will run multiple attack behaviours randomly now.

This is pretty awesome because it allows us to reuse the same attacks in various different situations.